<?php /* @var $news News */ ?>
 
<div class="center_title"><?php echo __('Vintage articles')?></div>

<div class="center_text">
<?php foreach( $pager->getResults() as $news ):?>
    <div class="news_item">
        <div class="news_topic">
            <div class="news_title">
                <?php echo seo_link_to(
                                $news->getName()
                                , 'news'
                                , 'view'
                                , $news->getId()
                                , array(
                                    'style' => ''
                                )); ?>
                <?php if( $sf_user->isAuthenticated() ): ?>
                    <?php echo link_to(
                                    image_tag(
                                        'pencil.png'
                                        , array(
                                            'alt' => 'edit'
                                        )
                                    )
                                    , 'news/edit?id=' . $news->getId()); ?>
                <?php endif; ?>
            </div>
            <div class="news_date"><?php echo $news->getCreatedAt('Y-m-d'); ?></div>
            <div style="clear: both;"></div>
        </div>
        <div class="news_text">
            <div class="news_img">
                <?php if( ($photo = Files::getFirst($news->getId(), MyConstants::TYPE_NEWS, MyConstants::UNDEFINED_ID)) != null ): ?>
                    <?php echo image_tag(
                                    '/images/gallery/tiny/' . $photo->getUname()
                                    , array(
                                        'alt' => $news->getName()
                                        , 'title' => $news->getName()
                                    )) ?>
                <?php endif; ?>
            </div>
            <?php echo seo_link_to(
                            $news->getSummary()
                            , 'news'
                            , 'view'
                            , $news->getId()
                            , array(
                                'class' => 'news_summary'
                            )
                        ); ?>(<?php echo $news->getRemarksNumber()?>)
            <br/><br/>
            <?php echo seo_link_to(__('more..')
                                , 'news'
                                , 'view'
                                , $news->getId()
                                )?>
        </div>
        <div style="clear: both;"></div>
    </div>
<?php endforeach; ?>

<?php if ($pager->haveToPaginate()): ?>
	<div class="paging">
		<div class="paging_link">
			<?php echo link_to(
					'&laquo;'
					, 'news/showall?page='.$pager->getFirstPage()
				) ?>
		</div>
		<div class="paging_link">
			 <?php echo link_to(
					'&lsaquo;'
					, 'news/showall?page='.$pager->getPreviousPage()
				) ?>
		</div>
			<?php $links = $pager->getLinks(); foreach ($links as $page): ?>
			<?php echo ($page == $pager->getPage()) ? '<div class="paging_current">' . $page . '</div>' : '<div class="paging_link">' . link_to($page, 'news/showall?page='.$page) . '</div>' ?>
			<?php if ($page != $pager->getCurrentMaxLink()): ?>
			<?php endif; ?>
			<?php endforeach; ?>
		<div class="paging_link">
			<?php echo link_to(
						'&rsaquo;'
						, 'news/showall?page='.$pager->getNextPage()
					) ?>
		</div>
		<div class="paging_link">
			<?php echo link_to(
						'&raquo;'
						, 'news/showall?page='.$pager->getLastPage()
					) ?>
		</div>
	</div>
<?php endif ?>

</div>